Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hw 3.1 #16

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Hw 3.1 #16

wants to merge 13 commits into from

Conversation

tankisleva
Copy link

fix got hw3.1

Copy link

@sashkir7 sashkir7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Добрый день
Работу принял. В комментах подсветил пару моментов

Comment on lines +12 to +13
private final SelenideElement statisticsHeader = $(".css-giaux5");
private final SelenideElement historyHeader = $(".css-uxhuts");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Подобные классы .css-giaux5 лучше не использовать в качестве локаторов - выглядит очень ненадежно (+ скорее всего они формируются динамически, рандомно)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправил

private final SelenideElement archiveButtonSubmit = $x("//button[text()='Archive']");
private final SelenideElement unarchiveButtonSubmit = $x("//button[text()='Unarchive']");
private final ElementsCollection categoryList = $$(".MuiChip-root");
private final SelenideElement successArchiveMessage = $x("//div[@class='MuiAlert-message css-1xsto0d']");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Опять же класс css-1xsto0d лучше не использовать
Можно просто $("div.MuiAlert-message")

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправил

Comment on lines +27 to +28
nameInput.clear();
nameInput.setValue(name);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Перед setValue() clear() делать не обязательно

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправил

Comment on lines +44 to +54
for (int i = 0; i < categoryList.size(); i++) {
// Проверяем, содержит ли элемент текст категории
if (categoryList.get(i).text().equals(categoryName)) {
// Находим кнопку "Архивировать" внутри той же строки с названием категории
SelenideElement archiveButtonInRow = categoryList.get(i).parent().$(".MuiIconButton-sizeMedium[aria-label='Archive category']");
// Кликаем по кнопке архивирования
archiveButtonInRow.click();
break;
}
}
return this;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Как правило, писать собственные циклы в page-object классах нам не нужно
За нас все давно уже реализовано. Например, здесь можно воспользоваться filter от Selenide
categoryList.findBy(text(categoryName)) - далее находим кнопку и тыкаем

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправил

Comment on lines +58 to +68
// Проходим по списку категорий
for (int i = 0; i < categoryList.size(); i++) {
// Проверяем, содержит ли элемент текст имени категории
if (categoryList.get(i).text().equals(categoryName)) {
// Находим кнопку "Разархивировать" внутри той же строки с названием категории
SelenideElement unarchiveButtonInRow = categoryList.get(i).parent().$("[data-testid='UnarchiveOutlinedIcon']");
// Кликаем по кнопке разархивирования
unarchiveButtonInRow.click();
break;
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Аналогично

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправил

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants